package ch01.strategy;

/**
 * Created by zc on 2016/11/20.
 */
public class StrategyFactory {

    public static IStrategy getStrategy(StrategyMan strategyMan){
        IStrategy strategy = null;
        try {
            strategy = (IStrategy) Class.forName(strategyMan.getValue()).newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        return strategy;
    }
}
